﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;
using ZLDC.Common.Estate;
namespace ZLDC.Estate.Quantify
{
    public partial class lp_Configuration : System.Web.UI.Page
    {
      
        protected int pagesize = 20;
        protected static int Pcount = 0;
        protected int Ppcount = 0;//完成人数工作
        protected string deptid="0",depttype;
        protected void Page_Load(object sender, EventArgs e)
        {
            depttype = ZLDC.Topo.BLL.Estate.lp_Report_list.GetType(_Utility.GetInfoBySession().m_sDeptID);//获取部门类型
            if (!IsPostBack)
            {
                GetSelect(depttype);
            }
            
        }

        #region 查询部门用户
        protected void GetList(string deptid)
        {
            switch (depttype)
            {
                case "分行":
                    ZLDC.Topo.BLL.Estate.lp_Configuration.GetList(RpList, deptid);
                    break;
                case "区域":
                    
                    ZLDC.Topo.BLL.Estate.lp_Configuration.GetList(RpList, sBranch.Value);
                    break;
            }
            
            
        }
        protected void GetSBranch(string deptid)
        {
           
                string sql = "select * from t_zlhq_t_s_alldept where  DltFlg=0 and parent_id=" + deptid + "";
                ZLDC.Topo.BLL.Estate.lp_Basis.droplist(sBranch, "name", "id", sql);
            
        }
        protected void GetSelect(string depttype)
        {
            switch (depttype)
            { 
                case "分行":
                    deptid = _Utility.GetInfoBySession().m_sDeptID;
                    GetList(deptid);
                    break;
                case "区域":
                    GetSBranch(_Utility.GetInfoBySession().m_sDeptID);
                    span1.Style["display"] = "block";
                    deptid =sBranch.Value;
                    GetList(deptid);
                    break;
                //case "营业部":
                //    GetSBranch(_Utility.GetInfoBySession().m_sDeptID);
                //    span1.Style["display"] = "block";
                //    deptid = sBranch.Value;
                //    GetList(deptid);
                    //break;
            }
        }
        #endregion

        protected void Button1_Click(object sender, EventArgs e)
        {
            ZLDC.Topo.BLL.Estate.lp_Configuration.BtnAdd(RpList, Ppcount,Pcount,this.Page,deptid);
        }

        protected void btnGetlist_Click(object sender, EventArgs e)
        {
            GetList(deptid);
        }

       

       
    }
}
